package tt.com.warehousemanager.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tt.com.common.enums.Status;
import tt.com.common.util.CommonResult;
import tt.com.warehousemanager.service.PurchaseService;
import tt.com.warehousemanager.service.WarehouseStockRecordService;

import java.math.BigDecimal;

/**
 * @author Czycka
 * @date 2022/8/31 21:15
 * @description
 */
@RestController
@RequestMapping(value = "warehouse/ledger")
public class WareHouseLedgerController {

    @Autowired
    PurchaseService purchaseService;

    @Autowired
    WarehouseStockRecordService recordService;

    @PostMapping(value = "today/purchase")
    public CommonResult purchaseToday(){
        return CommonResult.buildR(Status.OK,"查询成功",purchaseService.showCostByToday());
    }

    @PostMapping(value = "week/purchase")
    public CommonResult purchaseWeek(){
        return CommonResult.buildR(Status.OK,"查询成功",purchaseService.showCostByWeek());
    }

    @PostMapping(value = "month/purchase")
    public CommonResult purchaseMonth(){
        return CommonResult.buildR(Status.OK,"查询成功",purchaseService.showCostByMonth());
    }

    @PostMapping(value = "year/purchase")
    public CommonResult purchaseYear(){
        return CommonResult.buildR(Status.OK,"查询成功",purchaseService.showCostByYear());
    }

    @PostMapping(value = "today/record")
    public CommonResult recordToday(){
        return CommonResult.buildR(Status.OK,"查询成功",recordService.showCostByToday());
    }

    @PostMapping(value = "week/record")
    public CommonResult recordWeek(){
        return CommonResult.buildR(Status.OK,"查询成功",recordService.showCostByWeek());
    }

    @PostMapping(value = "month/record")
    public CommonResult recordMonth(){
        return CommonResult.buildR(Status.OK,"查询成功",recordService.showCostByMonth());
    }

    @PostMapping(value = "year/record")
    public CommonResult recordYear(){
        return CommonResult.buildR(Status.OK,"查询成功",recordService.showCostByYear());
    }
}
